/**
 * 学生表model
 * author:cjf
 * 学号(student_id)描述(Integer、非空)、学生姓名(student_name)描述(String(100),非空)
 * 专业班级编号(major_id)描述(Integer、非空)、学生密码(student_pwd)描述(String(100)、非空)
 * 学生激活状态(student_state)描述(Integer、非空)注释(0未激活1激活)
 */
import { DbContext } from '@codefree/badger/service'
const db = DbContext.Sequelize;

export type StudentEntity = {
    student_id:Number,
    student_name:String,
    major_id:Number,
    student_pwd:String,
    student_state:Number
}

const studentEntity:StudentEntity = {
    student_id:{
        type:db.INTEGER,
        allowNull:false
    },
    student_name:{
        type:db.STRING(100),
        allowNull:false
    },
    major_id:{
        type:db.STRING(100),
        allowNull:false
    },
    student_pwd:{
        type:db.STRING(100),
        allowNull:false
    },
    student_state:{
        type:db.INTEGER,
        allowNull:false
    }
}

export default (sequelize) => {
    return {
        name: 'Student',
        define: sequelize.define("student", studentEntity, DbContext.defaultOptions)
    }
}